const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  devServer:{//开发服务器的配置
    port:3000, //端口号
    progress:true, //打包进度条
    contentBase:'./build' //默认运行目录
  },
  mode:'development',//production,development
  entry: './src/index.js', //入口
  output: {
    filename: 'bundle.[hash:8].js', //打包后的文件名可以加上hash值
    path: path.resolve(__dirname,'build')
  },
  plugins:[//插件
    new HtmlWebpackPlugin({
      template:'./src/index.html',
      filename:'index.html',
      minify:{
        removeAttributeQuotes:true,
        collapseWhitespace:true
      },
      hash:true
    })
  ]
}
